<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/common.jsp" %>
<%@ page import="com.chanyachting.emall.util.*" %>
<%@ page import="com.chanyachting.emall.domain.Member" %>
<%@ page import="com.chanyachting.emall.domain.Newsactivity" %>
<%@ page import="com.chanyachting.emall.service.MemberService" %>
<%@ page import="com.chanyachting.emall.service.NewsActivityService" %>
<%@ page import="com.chanyachting.emall.serviceImpl.NewsActivityServiceImpl" %>
<%@ page import="java.util.*" %>


<%

//显示“推荐中”的新闻活动列表

	RequestUtil ru=new RequestUtil(request);

	Member member=(Member)ru.getSessionObject(MemberService.MEMBER_IN_SESSION,new Member());
	
	int pageNo=Integer.parseInt(ru.getParameter("pageNo","1")); //获得用户选中的页面，默认为第一页


	Pager pager=new Pager(10);  //设置每页显示记录数量
	
	pager.setRowSize(Newsactivity.countByMemberIdAndRecommend(member.getId(),1)); //获得记录总数


%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<link href="css/import.css" type="text/css" rel="stylesheet" />
<title></title>

<script type="text/javascript" src="<%=root %>/js/jquery-1.3.2.min.js" charset="utf-8">//ADCRM</script>

<script language="javascript" type="text/javascript">

	$(function(){
	
		$.ajaxSetup ({
		    cache: false //关闭AJAX相应的缓存
		});
		
	});


	//发布新闻活动，状态修改为等待审核 
	function tocheck(id){

		$.get("<%=root %>/adminBackend/newsactivity.od?method=toCheck", { id: id },
				  function(data){
				   	alert("操作成功，请等待审核结果。");
				  });

		return false;

	}
	

</script>

</head>

<body>
<div class="tab_box">
	<div class="tab_menu">
    	<a href="newsactivity_create.jsp">发布新闻和活动</a>
    	<a href="newsactivity_manager.jsp" class="current">管理新闻和活动</a>
    </div>
    <div class="tab_submenu">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
           <td width="50%">
	          <div class="mu_title">
		          <a href="newsactivity_manager.jsp">新闻活动展示中</a>｜
		          <a href="newsactivity_norelease.jsp">待上架</a>｜
		          <a href="newsactivity_publish.jsp">推荐中</a>
		         <!-- ｜ <a href="newsactivity_tocheck.jsp">待审核</a> -->
	          </div>
          </td>
          <td align="right">&nbsp;</td>
        </tr>
      </table>
    </div>
</div>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="yes_border">
  <tr>
    <th height="36" colspan="6" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="no_border">
      <tr>
        <td width="15%" height="36" align="center"><label></label>
              <input type="submit" name="button4" id="button5" value=" 上 架 " />
              <input type="submit" name="button4" id="button6" value=" 删 除 " /></td>
        <td align="center">&nbsp;</td>
        <td width="15%" align="center">&nbsp;</td>
      </tr>
    </table></th>
  </tr>
  <tr>
    <td colspan="4" align="center" bgcolor="#E7E7E7"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="no_border">
      <tr>
        <td width="15%" align="center"><label>
          <input type="checkbox" name="checkbox3" id="checkbox3" />
          </label>
          全选本页产品信息</td>
        <td align="center">&nbsp;</td>
        <td width="15%" align="center">本页显示 10条产品信息</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <th width="15%" align="center">编号</th>
    <th align="center">新闻和活动主题</th>
    <th width="15%" align="center">上架日期</th>
    <!-- 
    <th width="15%" align="center">推荐到期日期</th>
     -->
  </tr>
  
  
  <%
  
	
	int firstIndex=(pageNo-1)*pager.getPageRowsSize();
	
	List list=Newsactivity.listByMemberIdAndRecommendWithPage(member.getId(),1,firstIndex,pager.getPageRowsSize());
	
	if(list!=null && list.size()>0){
		
		Newsactivity na=null;
		
		for(int i=0;i<list.size();i++){
			
			na=(Newsactivity)list.get(i);
			
%>
<tr>
    <td align="center"><input type="checkbox" name="checkbox" id="checkbox" /><%= na.getId() %></td>
    <td><%= na.getTitle() %></td>
    
    <td align="center"><%= na.getReleaseDate() %></td>
    <!-- <td align="center"><%= na.getMaturityTime() %></td> -->
   
  </tr>

<%
			
		}
		
		
	}
  
  %>
  
  
  <tr>
    <td colspan="4" bgcolor="#E7E7E7"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="no_border">
      <tr>
        <td width="15%" align="center"><label>
          <input type="checkbox" name="checkbox3" id="checkbox3" />
          </label>
          全选本页产品信息</td>
        <td align="center">&nbsp;</td>
        <td width="15%" align="center">
        <%
        	for(int i=1;i<=pager.getPageNumber();i++){
        		
        %>
        <a href="newsactivity_publish.jsp?pageNo=<%=i %>"><%=i %></a>
        <%		
        	}
        %>
        	本页显示 <%= pager.getPageRowsSize() %>条产品信息
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="6"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="no_border">
      <tr>
        <td width="15%" height="36" align="center"><label></label>
              <input type="submit" name="button3" id="button3" value=" 上 架 " />
              <input type="submit" name="button3" id="button4" value=" 删 除 " /></td>
        <td align="center">&nbsp;</td>
        <td width="15%" align="center">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

